//
//  Contact.m
//  04-集合(二)
//
//  Created by dllo on 16/7/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "Contact.h"

@implementation Contact

- (instancetype)initWithName:(NSString *)name phoneNumber:(NSString *)phoneNumber
{
    self = [super init];
    if (self) {
        // 初始化方法中, 不要使用set方法赋值
        _name = name;
        _phoneNumber = phoneNumber;
    }
    return self;
}

+ (instancetype)contactWithName:(NSString *)name phoneNumber:(NSString *)phoneNumber
{
    return [[Contact alloc] initWithName:name phoneNumber:phoneNumber];
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"name = %@ sender = %@ phoneNumber = %@ address = %@ groupName = %@ age = %ld", _name, _sender, _phoneNumber, _address, _groupName, _age];
}

- (void)showContact
{
    NSLog(@"%@", self);
}

@end
